import { Ratelimit } from '@upstash/ratelimit'
import { Redis } from '@upstash/redis'
import { FREE_LIMIT_COUNT, LOGIN_LIMIT_COUNT } from '~/utils/constants'

const redis = Redis.fromEnv()

export const ratelimitForIps = new Ratelimit({
  redis,
  limiter: Ratelimit.slidingWindow(3, '1 d'),
})

export const ratelimitForApiKeyIps = new Ratelimit({
  redis,
  limiter: Ratelimit.slidingWindow(50, '1 d'),
})

export const ratelimitForFreeAccounts = new Ratelimit({
  redis,
  limiter: Ratelimit.slidingWindow(5, '1 d'),
})
